{literal}
<h2>Extending classes</h2>
<br>
Simple extending sample:
<pre class="code">
&lt;?php
/**
* @orm tableName users
*/
class BaseUser extends DomUser {
	
	/**
	* @orm char(20) unique
	*/
	protected $username;

}
/**
* @orm tableName users
*/
class MyUser extends BaseUser {
	
	/**
	* @orm char(20) unique
	* @orm listener beforeSet beforeSetUsername
	*/
	protected $username;
	
	/**
	* @orm plugin DomArDate
	*/
	protected $birthday;
	
	public function beforeSetUsername() {
		// do something
	}

}
?&gt;
</pre>



<h2>Extended class tables</h2>

Extending objects can be saved into same table as their parent. If child creates new columns these columns are created into that table. 
Consider previous sample code. There will be a table named <b>users</b> and it will have four columns: <b>id, className, username, birthday.</b><br>
If you want child class data to be saved into another table define another tablename. Sample:
<pre class="code">
&lt;?php
/**
* @orm tableName myusers
*/
class MyUser extends BaseUser {
	
	/**
	* @orm plugin DomArDate
	*/
	protected $birthday;

}
?&gt;
</pre>
Now there will be same table named <b>myusers</b> with four columns: <b>id, className, username, birthday.</b><br>
If you use BaseUser then it will create table named <b>users</b> with three columns: <b>id, className, username.</b><br>
{/literal}